package com.erp.stock.controller;

import com.erp.common.ResponseMessage;
import com.erp.common.controller.BaseControllerPowerful;
import com.erp.common.service.BaseService;
import com.erp.stock.entity.PrintingAndDyeingEnterprise;
import com.erp.stock.service.PrintingAndDyeingEnterpriseService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api("印染企业接口")
@RestController
@RequestMapping("/pdenterprise")
public class PrintingAndDyeingEnterpriseController extends BaseControllerPowerful<PrintingAndDyeingEnterprise> {
    @Autowired
    PrintingAndDyeingEnterpriseService service;

    @Override
    protected BaseService getService() {
        return this.service;
    }

    @GetMapping("/list")
    public ResponseMessage list(){
        List<PrintingAndDyeingEnterprise> list = service.list();
        if (list.size() > 0) {
            return new ResponseMessage(list);
        }
        return ResponseMessage.fail("无相关数据");
    }

}
